using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace Wumpus
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager Graphics;
        public GameState Gamestate;
        protected GraphicsEngine GraphicsEngine;

        public Game1()
        {
            this.Graphics = new GraphicsDeviceManager(this);
            this.Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            this.TargetElapsedTime = TimeSpan.FromTicks(333333);
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization call here
            List<List<int>> connections = new List<List<int>>(); //TODO: make this equal to a List made by the random map gen
            this.Gamestate = new GameState(connections);
            int PlayerPosition = 4; //TODO: decide on starting position
            this.Gamestate.Position = new Position(new List<Planet>(), connections, PlayerPosition); //TODO: fill planets with items/hazards

            base.Initialize();
        }

        protected override void LoadContent()
        {
            //TODO: move this code in to the graphics component or get rid of it
            Images Images = new Images();
            
            Images.Planet = this.Content.Load<Texture2D>("dot");
            Images.Line = this.Content.Load<Texture2D>("line");

            this.GraphicsEngine = new GraphicsEngine(this.Gamestate, this.GraphicsDevice, Images);
        }

        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        protected override void Update(GameTime gameTime)
        {
            // TODO: Add your update function call here

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            //TODO: Add Graphics Component Draw call here

            base.Draw(gameTime);
        }
    }
}
